<?php

namespace app\admin\controller\order;

use app\common\controller\Backend;
use hehe\Str;
use think\facade\Db;
use think\middleware\FormTokenCheck;

/**
 *
 */
class OperateLog extends Backend {
    /**
     * Goods模型对象
     * @var object
     * @phpstan-var \app\admin\model\goods\Goods
     */
    protected object $orderModel;
    protected object $orderGoodsModel;



    protected string|array $defaultSortField = 'id,desc';

    protected array|string $preExcludeFields = ['id', 'create_time'];

    protected string|array $quickSearchField = ['name', 'brand.name'];

    public function initialize(): void {
        parent::initialize();
        $this->model = new \app\admin\model\order\OrderGoodsStatusRecord();
    }



    /**
     * 操作记录
     */
    public function index(): void {
        $this->request->filter(['strip_tags', 'trim']);
        if ($this->request->param('select')) {
            $this->select();
        }
        $param = $this->request->param();

        list($where, $alias, $limit, $order) = $this->queryBuilder();
        $res = $this->model
            ->field($this->indexField)
            ->withJoin($this->withJoinTable, $this->withJoinType)
            ->alias($alias)
            ->where($where)
            ->where(['order_goods_id' => $param['id']])
            ->order($order)
            ->paginate($limit);

        $this->success('', [
            'list'   => $res->items(),
            'total'  => $res->total(),
            'remark' => get_route_remark(),
        ]);
    }




}